<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.model' );
class EcommerceModelDetail extends JModel
{
	var $_detail = null;
	var $_id = null;
	
	function __construct()
	{
		parent::__construct();
		$id = intval(JRequest::getVar('id', 0));
		$this->_id = $id;
	}
	function getDetail()
	{
		if(!$this->_detail)
		{
			$query = "SELECT a.*, b.name AS company".
			" FROM #__pr_product AS a LEFT JOIN #__pr_company AS b ON a.manufacturer = b.id WHERE a.id = " . $this->_id ;
			
			$this->_db->setQuery($query);
			$this->_detail = $this->_db->loadObject();
		}
		return $this->_detail;
	}
}
?>